package tree;

import offer.TreeNode;

public class leetCode700_searchBST {

    public TreeNode searchBST(TreeNode root, int val) {
        if(root == null) return null;
        if(root.val > val){
            return searchBST(root.left,val);
        }
        if(root.val < val){
            return searchBST(root.right,val);
        }
        if(root.val == val){
            return root;
        }
        return null;

    }
}
